home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Herois
/
Codigo.Cst
/
00081_Script_Movimento ondular
< prev
next >
Wrap
Text File
|
1999-03-19
|
3KB
|
99 lines
property spr, iniX, iniY
property anima, marca
property periodoX, deslocamentoX
property periodoY, deslocamentoY
property ampX, ampY
property metodo
property pulo
property memoria, limitado
on getBehaviorDescription
return "Movimento senoidal"
end
on getPropertyDescriptionList
set p_list = [ ¼
#periodoX: [ #comment: "Periodo do movimento X",¼
#format: #integer,¼
#default: 600 ],¼
#deslocamentoX: [ #comment: "Deslocamento do movimento X",¼
#format: #integer,¼
#default: 0 ],¼
#ampX: [ #comment: "Amplitude maxima do movimento X",¼
#format: #integer,¼
#default: 30 ],¼
#periodoY: [ #comment: "Periodo do movimento Y",¼
#format: #integer,¼
#default: 600 ],¼
#deslocamentoY: [ #comment: "Deslocamento do movimento Y",¼
#format: #integer,¼
#default: 0 ],¼
#ampY: [ #comment: "Amplitude maxima do movimento Y",¼
#format: #integer,¼
#default: 30 ],¼
#metodo: [ #comment: "Extras",¼
#format: #integer,¼
#default: 0 ],¼
#memoria: [ #comment: "Limite minimo de memoria para movimento",¼
#format: #integer,¼
#default: 0 ]¼
]
return p_list
end
on beginSprite me
set spr = the spriteNum of me
set iniX = the locH of sprite spr
set iniY = the locV of sprite spr
set anima = 0
set pulo = random(periodoX)
global myMemSize
if myMemSize < memoria * 1024 * 1024 then
set limitado = true
else
set limitado = false
end if
end
on idleSprite me
if limitado then return
if anima = 0 then
set anima = the timer
else
global gMustUpdate
set tmp = the timer - anima
if metodo = 1 then
if tmp > pulo then
set anima = anima - random(periodoX)
set tmp = the timer - anima
set pulo = 0
end if
if tmp > periodoX and tmp > pulo then
set pulo = random(periodoX)
set anima = the timer + periodoX
end if
end if
if ampX <> 0 then
set tmpX = (tmp + deslocamentoX) mod periodoX
set tmpX = float(tmpX) / periodoX * 2.0 * pi
set x = iniX + Integer(sin(tmpX) * ampX)
if the locH of sprite spr <> x then
set the locH of sprite spr to x
set gMustUpdate to true
end if
end if
if ampY <> 0 then
set tmpY = (tmp + deslocamentoY) mod periodoY
set tmpY = float(tmpY) / periodoY * 2 * pi
set y = iniY + Integer(sin(tmpY) * ampY)
if the locV of sprite spr <> y then
set the locV of sprite spr to y
set gMustUpdate to true
end if
end if
end if
end